import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from '@/router'
import { installPinia } from '@/store'
import * as Cesium from 'cesium'
import 'uno.css'
import AppLoading from '@/components/AppLoading.vue'

async function startup() {
  // 载入全局loading加载状态
  const appLoading = createApp(AppLoading)
  appLoading.mount('#appLoading')

  Cesium.Ion.defaultAccessToken = import.meta.env.VITE_CESIUM_TOKEN

  const app = createApp(App)

  app.use(router)

  await installPinia(app)

  setTimeout(() => {
    // 卸载载入动画
    appLoading.unmount()
    // 挂载
    app.mount('#app')
  }, 1000)
}

startup()
